package com.sqstudio.llk.view
{
	import com.sqstudio.llk.command.event.GameEvent;
	
	import flash.events.MouseEvent;
	import flash.filters.GlowFilter;
	
	import org.robotlegs.mvcs.Mediator;
	
	public class ItemMediator extends Mediator
	{
		[Inject]
		public var item:ItemView;
		
		public function ItemMediator()
		{
			
		}
		
		override public function onRegister():void
		{
			eventMap.mapListener(item,MouseEvent.CLICK,change);
		}
		
		private function change(e:MouseEvent):void
		{
			dispatch(new GameEvent(GameEvent.RESTART_SELECT,this));
		}
		
		public function changeType():void{
			item.changeType();
		}
		
		public function changeFilters(isVisiable:Boolean = false):void{
			if(isVisiable){
				item.filters = [new GlowFilter(0xffffff,1,6,6,2,1,true)];
			}else{
				item.filters = null;
			}
		}
	}
}